package xml;

import java.io.File;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

public class ReadAllInfo {
	
	static void readAllInfo(String fileName) throws ParserConfigurationException, SAXException, IOException {
		File xml = new File(fileName);
		DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = fac.newDocumentBuilder();
		Document doc = builder.parse(xml);
		doc.normalize();
		
		Node root = doc.getFirstChild();
		System.out.println("root node : "+ root);
		NodeList list = doc.getElementsByTagName("brand");
		System.out.println(list.item(0).getTextContent());
		for (int i = 0; i < root.getChildNodes().getLength(); i++) {
			
		}
		
	}
	
	
	public static void main(String[] args) {
		try {
			readAllInfo("Market.xml");
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
